use crate::solution::Solution;

impl Solution {
    pub fn flip_lights(n: i32, presses: i32) -> i32 {
        match presses {
            0 => 1,
            1 => if n == 2 { 3 } else { (1 << n.min(4)).min(4) },
            2 => (1 << n.min(4)).min(7),
            _ => (1 << n.min(4)).min(8)
        }
    }
}


#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_1() {
        let result = Solution::flip_lights(1, 1);
        println!("{}", result);

        assert_eq!(result, 2);
    }

    #[test]
    fn test_2() {
        let result = Solution::flip_lights(2, 1);
        println!("{}", result);

        assert_eq!(result, 3);
    }

    #[test]
    fn test_3() {
        let result = Solution::flip_lights(3, 1);
        println!("{}", result);

        assert_eq!(result, 4);
    }


}
